<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .container {
        margin: 0 auto;
        width: 500px;
        height: 500px;
        border: 1px dotted #ccc;

        .top {
          height: 70%;
          display: flex;
          justify-content: center;
          align-items: center;

          .box {
            width: 100px;
            height: 100px;
            background: blue;
            /* animation: change 3s infinite alternate; */
            transition: border-radius 0.3s ease;
          }
        }

        .footer {
          text-align: center;
        }
      }

      @keyframes change {
        0% {
          border-radius: 0;
        }

        50% {
          border-radius: 50%;
        }

        100% {
          border-radius: 0;
        }
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="top">
        <div class="box"></div>
      </div>
      <div class="footer">
        <input
          id="range"
          type="range"
          min="0"
          max="50"
          step="0.5"
          value="0"
          onchange="change(value)"
          oninput="input (value)"
        />
      </div>
    </div>

    <script>
      const box = document.querySelector(".box");

      function change(value) {
        // 鼠标松开
        console.log("change:", value);
      }

      function input(value) {
        // 实时变换
        console.log("input :", value);

        box.style.borderRadius = value + "%";
      }
    </script>
  </body>
</html>
